package com.yaoxuguang.concurrence.thread_state.new_runable_terminated_time_waiting;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.thread_state
 * @Description: 线程状态
 * @date 2018年12月26日11:15
 */
public class MyThread extends Thread {
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
            System.out.println("mythread state=" + Thread.currentThread().getState());
            System.out.println("线程运行...");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try {
            MyThread myThread = new MyThread();
            System.out.println("mythread state=" + myThread.getState());
            myThread.start();
            System.out.println("mythread state=" + myThread.getState());
            Thread.sleep(1000);
            System.out.println("mythread state=" + myThread.getState());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
